import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";

export default defineConfig({
  plugins: [
    vue(),
    AutoImport({ imports: ["vue", "vue-router", "vuex"] }),
    Components({ resolvers: [AntDesignVueResolver({ resolveIcons: true })] }),
  ],
  resolve: {
    alias: {
      "@": resolve(__dirname, "./src"),
      vue: "vue/dist/vue.esm-bundler.js",
    },
  },
  css: {
    preprocessorOptions: {
      less: {
        modifyVars: {
          "primary-color": "#0066FF",
          "link-color": "#0066FF",
          "border-radius-base": "2px",
        },
        javascriptEnabled: true,
      },
    },
  },
  server: {
    port: 3888,
    proxy: {
      "/api": {
        target: "http://poc03.server.zzzc.qihoo.net:9091",
        changeOrigin: true,
      },
      "/directus": {
        // 本地
        target: "http://poc03.server.zzzc.qihoo.net:8055",
        // 线上
        // target: "https://openstack39.add.shyc2.qihoo.net/directus",
        // 武汉环境
        // target: "https://10.19.36.51/directus",
        changeOrigin: true,
        rewrite: (p) => p.replace(/^\/directus/, ""),
      },
    },
  },
  base: "/ai-app-linkManagement/",
  build: { outDir: "ai-app-linkManagement" },
});







